﻿<%@ WebHandler Language="C#" Class="StatusRoom" %>

using System;
using System.Web;

public class StatusRoom : IHttpHandler {
    
    public void ProcessRequest (HttpContext context) {
        object objstr = null;
        try
        {
            string nameroom = context.Request.QueryString["r"];
            if (nameroom != null)
            {
                string strsql = "";
                LibQLKS.LeTan.LT_Phong phong = new LibQLKS.LeTan.LT_Phong();
                strsql = "select  cast(TinhTrang as varchar(2)) from LT_Phong phong where LTrim(Rtrim(TenPhong))='" + nameroom.Trim() + "'";
                objstr = phong.GetReturnOne(strsql);
            }
        }
        catch 
        {
            throw new InvalidProgramException("không the lay duoc tinh trang phong!"); 
        }
        context.Response.ContentType = "text/plain";
        if (objstr != null)
        {
            context.Response.Write(objstr.ToString());
        }
    }
 
    public bool IsReusable 
    {
        get {
            return false;
        }
    }

}